//
//  BLGifHeader.swift
//  许鲜
//
//  Created by hbl on 16/4/25.
//  Copyright © 2016年 hbl. All rights reserved.
//

import UIKit
import MJRefresh

class BLGifHeader: MJRefreshGifHeader {
    var height:CGFloat?
    override func prepare() {
        super.prepare()
        lastUpdatedTimeLabel.hidden = true
        stateLabel.font = UIFont.systemFontOfSize(10)
        height = mj_h
        var  beginImages = Array<UIImage>()
        for i in 0...34 {
            let str = String(format: "load-%d",i)
            let image = UIImage(named: str)
            beginImages.append(image!)
        }
        self.setImages(beginImages, forState: MJRefreshState.Idle)
        
        var refreshingImage = Array<UIImage>()
        for i in 34...35 {
            let str = String(format: "load-%d",i)
            let image = UIImage(named: str)
            refreshingImage.append(image!)
        }
        self.setImages(refreshingImage, forState: MJRefreshState.Refreshing)
    }
    
    override func placeSubviews() {
        super.placeSubviews()
        gifView.contentMode = UIViewContentMode.ScaleAspectFill
        gifView.mj_h = 40
        gifView.mj_w = 40
        gifView.center = center
        gifView.mj_y = 5
        
        stateLabel.mj_y = CGRectGetMaxY(gifView.frame) - 25
       self.mj_h = 65
    }
}
